import { FC,useEffect, useState ,useContext} from 'react';
import { useNavigate } from 'react-router';
import { Context } from '../views/Demo'; 

const Index: FC<any> = (props:any): JSX.Element => {

   let con:any= useContext(Context)

   console.log(con.token);
   console.log(con.user);

   const update=()=>{
 
    con.setUser({...con.user,name:"王五"})
   }

    useEffect(()=>{
    },[])

    return (
      <div>
组件1
 {

con.user.name
 }
 <button onClick={()=>update()}>子组件修改</button>

      </div>
    )
}
export default Index;